﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceDog.Lib.Farm.Generic
{
    /// <summary>
    /// 动物行为接口
    /// </summary>
    /// <typeparam name="T1">普通泛型类型</typeparam>
    /// <typeparam name="T2">逆变类型，只能用作方法的参数和set访问器类型，基类泛型集合类型可以赋值给派生类泛型集合类型，代表：IComparer<T></typeparam>
    /// <typeparam name="T3">协变类型，用作返回类型和get访问器类型，派生类泛型集合类型可以赋值给基类泛型集合类型,代表：IEnumable<T></typeparam>
    interface IBehavior<T1, in T2, out T3> where T1 : Animal where T2 : Cow where T3 : Chicken
    {
        void AnimalWalk(T1 animal);
        T1 GetFirstAnimal();
        T1 LastAniaml { get; set; }
        T1 GetLastAniaml { get; }
        T1 SetLastAniaml { set; }

        void CowWalk(T2 Cow);
        //T2 GetFirstCow();
        //T2 LastCow { get; set; }
        //T2 GetLasCow { get; }
        T2 SetLastCow { set; }

        //void ChickenWalk(T3 Chicken);
        T3 GetFirstChicken();
        //T3 LastChicken { get; set; }
        T3 GetLastChicken { get; }
        //T3 SetLastChicken { set; }
    }
}
